//
//  LWModifyPwdCtrl.m
//  laowu
//
//  Created by 曹秀云 on 15/5/1.
//  Copyright (c) 2015年 长沙市岳麓区立早网络科技有限公司. All rights reserved.
//

#import "LWModifyPwdCtrl.h"
#import "LWModifSucCtrl.h"

@interface LWModifyPwdCtrl ()

@end

@implementation LWModifyPwdCtrl

- (void)viewDidLoad {
    [super viewDidLoad];
    [self  setTitle:@"密码修改"];
    [self.contentView setCornerRadius:0 borderWidth:1 borderColor:HEXColor(@"#dfdfdf")];
   
    
}



- (IBAction)enterBtnClick:(id)sender {
    
    if (ISBLANK(self.oldPwdTextFiled.text)) {
        [DialogUtils showTipsWithView:nil String:@"请输入旧密码！"];
        return;
    }
    if (ISBLANK(self.nowPwdTextFiled.text)) {
        [DialogUtils showTipsWithView:nil String:@"请输入新密码！"];
        return;
    }
    if (ISBLANK(self.now2PwdTextFiled.text)) {
        [DialogUtils showTipsWithView:nil String:@"请输入新密码！"];
        return;
    }
    
    
    if (![self.nowPwdTextFiled.text isEqualToString:self.now2PwdTextFiled.text]){
        [DialogUtils showTipsWithView:nil String:@"两次密码不一致！"];
        return;
    }

    
    [MeDataTool change_pswWithParam:self.oldPwdTextFiled.text newpwd:self.nowPwdTextFiled.text success:^(BaseResponse *result) {
        if (result.isSucc) {
            [DialogUtils showTipsWithView:nil String:@"修改密码成功"];
            [self.navigationController pushViewController:[[LWModifSucCtrl alloc] init] animated:YES];
        }else{
            [DialogUtils showTipsWithView:nil String:result.msg];
        }
    } failure:^(NSError *error) {
        [DialogUtils showTipsWithView:nil String:@"修改密码失败！"];
    }];


    
    NSLog(@"enterBtnClick");
}
@end
